#include <stdio.h>
#include "../List.h"

int main(void) {
  char  text1[100] = "Hello World!";
  char  text2[100] = "Test me";
  List* list       = list_new();
  List* item       = NULL;
  int   i          = 0;

  printf("Initial length: %i\n", list_length(list));

  for (i = 0; i != 10000; i++)
      list = list_append(list, text1);
  printf("After calling list_append 10000 times: %i\n", list_length(list));

  list = list_remove_data(list, text1);
  printf("After removal: %i\n", list_length(list));

  list = list_append(list, text1);
  for (i = 0; i != 10000; i++)
      list = list_append(list, text2);
  printf("After calling list_append 10001 times: %i\n", list_length(list));

  list = list_remove_data(list, text2);
  printf("After removal: %i\n", list_length(list));

  list = list_append(list, text2);
  item = list_get_first(list);
  printf("First item: %s\n", (char*)(item->data));
  item = list_get_last(list);
  printf("Last item: %s\n", (char*)(item->data));

  return 0;
}
